import { defHttp } from "@/utils/http";

export type UserGroupVO = {
	id: number;
	name: string;
	description: string;
	userIds: number[];
	status: number;
	remark: string;
	createTime: string;
};

// 创建用户组
export const createUserGroup = async (data: UserGroupVO) => {
	return await defHttp.post({
		url: "/bpm/user-group/create",
		data: data
	});
};

// 更新用户组
export const updateUserGroup = async (data: UserGroupVO) => {
	return await defHttp.put({
		url: "/bpm/user-group/update",
		data: data
	});
};

// 删除用户组
export const deleteUserGroup = async (id: number) => {
	return await defHttp.delete({ url: "/bpm/user-group/delete?id=" + id });
};

// 获得用户组
export const getUserGroup = async (id: number) => {
	return await defHttp.get({ url: "/bpm/user-group/get?id=" + id });
};

// 获得用户组分页
export const getUserGroupPage = async params => {
	return await defHttp.get({ url: "/bpm/user-group/page", params });
};

// 获取用户组精简信息列表
export const getUserGroupSimpleList = (): Promise<UserGroupVO[]> => {
	return defHttp.get({ url: "/bpm/user-group/simple-list" });
};
